<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
	<style>
		.box{
			width: 200px;
			height: 200px;
			background: linear-gradient(270deg,#e53935 0%, #ffffff 3%);
		}
	</style>
</head>
<body>

	<div>
		<div class="box"></div>
	</div>
    <script>

	function previewPdf(fileBase64){
		let fileBlob = this.base64ToBlobsdf(fileBase64,'application/pdf');
	  downloadBadge(fileBlob, `zhangsan的展证.png`)
		// let basePdfUrl = window.URL.createObjectURL(fileBlob);
		// sessionStorage.setItem('basePdfUrl', basePdfUrl);
		// location.href = "lookPdf.html";
		// let newWindow = window.open("");
		// newWindow.document.write("<iframe width='100%' height='100%' src='"+href+"'></iframe>");
	};

	function viewPdf(content) {
		console.log("content",content)
		const blob = this.base64ToBlob(content)
		console.log(`blob=`, blob);
		// if (window.navigator && window.navigator.msSaveOrOpenBlob) {
		// 	window.navigator.msSaveOrOpenBlob(blob)
		// } else {
			const fileURL = URL.createObjectURL(blob)
			window.open(fileURL);//弹出ppf文件
		// }
	}
	function base64ToBlobsdf(fileBase64,fileType){
		fileBase64 = fileBase64.replace(/[\n\r]/g, '').substring(22,fileBase64.length)
		let raw = window.atob(fileBase64);
		let rawLength = raw.length;
		let uint8Array = new Uint8Array(rawLength);
		while (rawLength--){
			uint8Array[rawLength] = raw.charCodeAt(rawLength);
		}
		return new Blob([uint8Array],{type: fileType});
	}

	function base64ToBlob(code) {
		code = code.replace(/[\n\r]/g, '').substring(22,code.length)
		// escape(atob(str)

		console.log(`code=`, code);
		// var raw = decodeURIComponent(escape(atob(str)));
		// atob() 方法用于解码使用 base-64 编码的字符串。
		const raw = window.atob(code)
		const rawLength = raw.length
		const uInt8Array = new Uint8Array(rawLength)
		for (let i = 0; i < rawLength; ++i) {
			uInt8Array[i] = raw.charCodeAt(i)
		}
		return new Blob([uInt8Array], { type: 'application/pdf' })
	}

    // if({}){
    //     console.log('111')
    // }
    // if([]){
    //     console.log('222')
    // }

	


[{minImg: 'http://10.21.64.23:8085/image/200.200.80.40.0/0215103364de4fdb8e1f4545559fc4c9.jpg', maxImg: 'http://10.21.64.23:8085/image/200.200.80.40.0/0215103364de4fdb8e1f4545559fc4c9.jpg', video: false},

{minImg: 'http://10.21.64.23:8085/image/getDocumentUrl/3270835009224800192', maxImg: 'http://10.21.64.23:8085/image/getDocumentUrl/3270835009224800192', video: true},

{minImg: 'http://10.21.64.23:8085/image/80.80.80.40.0/7cb605ba15124dc1ab5a05d13ca2cf1b.jpg', maxImg: 'http://10.21.64.23:8085/image/0.0.80.40.0/7cb605ba15124dc1ab5a05d13ca2cf1b.jpg', video: false},

{minImg: 'http://10.21.64.23:8085/image/80.80.80.40.0/d3c6ca506e364c54a47f4e61c327e62d.jpg', maxImg: 'http://10.21.64.23:8085/image/0.0.80.40.0/d3c6ca506e364c54a47f4e61c327e62d.jpg', video: false},

 
{minImg: 'http://10.21.64.23:8085/image/80.80.80.40.0/e1fa8cbaf98b4729bc8d2fd1b4df844c.jpg', maxImg: 'http://10.21.64.23:8085/image/0.0.80.40.0/e1fa8cbaf98b4729bc8d2fd1b4df844c.jpg', video: false},


{minImg: 'http://10.21.64.23:8085/image/80.80.80.40.0/f381eee3625f4eb3909be77f80580446.jpg', maxImg: 'http://10.21.64.23:8085/image/0.0.80.40.0/f381eee3625f4eb3909be77f80580446.jpg', video: false},
 
{minImg: 'http://10.21.64.23:8085/image/80.80.80.40.0/a8fd54c63b4d4b7eb8d5fcaf571c1668.jpg', maxImg: 'http://10.21.64.23:8085/image/0.0.80.40.0/a8fd54c63b4d4b7eb8d5fcaf571c1668.jpg', video: false}]
     const arr =[
     { id: "item.id",
			name: "item.supplierName",
			logoUrl: "item.logoUrl",
			boothNo: "item.boothNo",
			mainProduct: "item.adProducts",
			detailUrl: "item.supplierUrl",
			productName: "product.name",
			productImageUrl: "product.imageUrl,",
			productDetailUrl: "product.goodsUrl"
        },
        { id: "item.id",
			name: "item.supplierName",
			logoUrl: "item.logoUrl",
			boothNo: "item.boothNo",
			mainProduct: "item.adProducts",
			detailUrl: "item.supplierUrl",
			productName: "product.name",
			productImageUrl: "product.imageUrl,",
			productDetailUrl: "product.goodsUrl"
        },
     ]     



    //  console.log((Math.random() * (5.0 - 4.5) + 4.5).toFixed(1))


    


    </script>
</body>
</html>